package org.nepu.srr.设备设施资料.钻井设备证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;


@Data
public class B42DrillingDeviceParams {
    @ApiModelProperty("钻井绞车")
    CommonIn drillingCar;

    @ApiModelProperty("钻井泵")
    CommonIn drillingPump;

    @ApiModelProperty("天车")
    CommonIn crownBlock;

    @ApiModelProperty("游动滑车")
    CommonIn rollingCar;

    @ApiModelProperty("钻井水龙带")
    CommonIn waterWell;

    @ApiModelProperty("转盘")
    CommonIn turnTable;

    @ApiModelProperty("顶部驱动")
    CommonIn topDrive;

    @ApiModelProperty("井架")
    CommonIn wellFrame;

    @ApiModelProperty("钻井大绳")
    CommonIn mainString;

    @ApiModelProperty("悬臂梁滑移装置")
    CommonIn handLug;

    @ApiModelProperty("钻井仪表")
    CommonIn drillingMeter;

    @ApiModelProperty("防爆电器")
    CommonIn fireAlarm;

    @ApiModelProperty("铁钻工")
    CommonIn steelDriller;

    public B42DrillingDeviceResult rate(){
        double fullScore = 130;
        double score = 0;
        if(CommonMethods.isAllTrue(drillingCar.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(drillingPump.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(crownBlock.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(rollingCar.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(waterWell.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(turnTable.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(topDrive.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(wellFrame.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(mainString.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(handLug.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(drillingMeter.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(fireAlarm.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(steelDriller.getInput())){
            score += 10;
        }
        double rate = score / fullScore;
        B42DrillingDeviceResult result = new B42DrillingDeviceResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
